﻿using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NamingPipe.Server
{
    class Program
    {
        static void Main(string[] args)
        {
            using(NamedPipeServerStream serverStream = new NamedPipeServerStream("Test", PipeDirection.InOut))
            {
                try
                {
                    serverStream.WaitForConnection();
                    using(StreamReader reader = new StreamReader(serverStream))
                    {
                        Console.WriteLine(reader.ReadLine());
                        Console.ReadLine();
                    }
                }
                finally
                {
                    serverStream.Close();
                }
            }
        }
    }
}
